﻿using FitnessHelperDB;

namespace FitnessHelperDesktopClient
{
  /// <summary>
  /// Окно для отображения и редактирования планов питания
  /// </summary>
  public partial class FoodPlansWindow
  {
    #region Поля
    private readonly FitnessHelperModelContainer dbContext = new FitnessHelperModelContainer();
    #endregion


    #region Конструктор
    public FoodPlansWindow()
    {
      InitializeComponent();

      DataContext = dbContext;
    }
    #endregion


    #region Обработка событий
    private void Window_Closed(object sender, System.EventArgs e)
    {
      dbContext.Dispose();
    }

    private void ButtonSave_Click(object sender, System.Windows.RoutedEventArgs e)
    {
      dbContext.SaveChanges();
      Close();
    }

    private void ButtonCancel_Click(object sender, System.Windows.RoutedEventArgs e)
    {
      Close();
    }
    #endregion
  }
}
